Skip to content

Conversation

@bobtista
Copy link

@bobtista bobtista commented Jan 13, 2026

Summary

  • Apply clang-tidy cppcoreguidelines-explicit-virtual-functions fixes to add override keywords to virtual function overrides

  • Add OVERRIDE and FINAL macros to CppMacros.h for VC6 compatibility

  • Use OVERRIDE macro instead of bare override keyword in all affected files

  • Note had to rename a couple of things that conflicted with OVERRIDE and FINAL.

@greptile-apps
Copy link

greptile-apps bot commented Jan 13, 2026

Greptile Overview

Greptile Summary

Applied clang-tidy cppcoreguidelines-explicit-virtual-functions fixes to add explicit override keywords to virtual function overrides across 65 files, with VC6 compiler compatibility maintained through macro abstraction.

Major changes

  • Added OVERRIDE and FINAL macros to CppMacros.h that expand to C++11 keywords on modern compilers or empty on legacy compilers
  • Renamed OVERRIDE<T> template class to OverridePtr<T> to avoid name collision with the new OVERRIDE macro
  • Renamed AnimStateType enum values (INITIALANIM_INITIAL, FINALANIM_FINAL, etc.) to avoid conflict with FINAL macro
  • Removed virtual keyword and added OVERRIDE macro suffix to hundreds of virtual function overrides across Core, Generals, and GeneralsMD codebases
  • Updated all usages of the renamed template class and enum values throughout the codebase

Assessment

This refactoring improves code safety by making virtual function overrides explicit, which helps catch errors at compile time when base class signatures change. The macro-based approach maintains backwards compatibility with Visual C++ 6.0 while providing modern C++ semantics on newer compilers. The changes are mechanical and comprehensive, properly handling name conflicts that arose from introducing the new macros.

Confidence Score: 5/5

  • This PR is safe to merge with minimal risk
  • The changes are purely mechanical refactoring following clang-tidy recommendations. The approach properly resolves name conflicts by renaming the template class and enum values. All changes are consistent across the three codebases (Core, Generals, GeneralsMD), and the macro abstraction correctly maintains VC6 compatibility while providing modern C++ safety on newer compilers.
  • No files require special attention

Important Files Changed

Filename Overview
Dependencies/Utility/Utility/CppMacros.h Added OVERRIDE and FINAL macros to provide C++11 keywords for VC6 compatibility
Generals/Code/GameEngine/Include/Common/Override.h Renamed OVERRIDE template class to OverridePtr to avoid macro name conflict
GeneralsMD/Code/GameEngine/Include/Common/Override.h Renamed OVERRIDE template class to OverridePtr to avoid macro name conflict
Generals/Code/GameEngineDevice/Include/W3DDevice/GameClient/Module/W3DDebrisDraw.h Renamed AnimStateType enum values from FINAL to ANIM_FINAL to avoid macro conflict
GeneralsMD/Code/GameEngineDevice/Include/W3DDevice/GameClient/Module/W3DDebrisDraw.h Renamed AnimStateType enum values from FINAL to ANIM_FINAL to avoid macro conflict

Sequence Diagram

sequenceDiagram
    participant Dev as Developer
    participant CT as clang-tidy
    participant Macro as CppMacros.h
    participant Template as OVERRIDE Template Class
    participant Enum as AnimStateType Enum
    participant Files as Virtual Functions (65 files)

    Dev->>CT: Run cppcoreguidelines-explicit-virtual-functions
    CT->>Files: Identify missing override keywords
    CT-->>Dev: Generate fixes
    
    Dev->>Macro: Add OVERRIDE and FINAL macros
    Note over Macro: C++11: #define OVERRIDE override<br/>Pre-C++11: #define OVERRIDE (empty)
    
    Dev->>Template: Rename OVERRIDE<T> class
    Note over Template: Conflict: template name vs macro name
    Template-->>Template: Rename to OverridePtr<T>
    
    Dev->>Enum: Rename FINAL enum value
    Note over Enum: Conflict: enum value vs FINAL macro
    Enum-->>Enum: Rename to ANIM_FINAL
    
    Dev->>Files: Replace "virtual" with "OVERRIDE"
    Note over Files: Remove virtual keyword<br/>Add OVERRIDE macro suffix
    
    Files-->>Dev: VC6 compatible code with override semantics
Loading

@bobtista bobtista force-pushed the bobtista/clang-tidy-cppcoreguidelines-explicit-virtual-functions branch 3 times, most recently from 20a3b96 to 283d9e8 Compare January 14, 2026 20:57
@bobtista bobtista force-pushed the bobtista/clang-tidy-cppcoreguidelines-explicit-virtual-functions branch from 283d9e8 to 999978f Compare January 30, 2026 02:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant